var app = getApp();
var config = require("../../config.js");
Page({
    data: {
        courselist:"",
        color: "#7fabfd",
        newsList: [],
        HomeIndex: 0
    },
    onShow: function () {
        this.getData()
    },

    getData() {
        let role =  wx.getStorageSync("role");
        if(role == "学生") {
            let studentid = wx.getStorageSync("studentId");
            let that = this
            wx.request({
                url: 'http://localhost:8080/Examination_System_war/wxappeal/wxShowAppeal',
                data: {
                  studentid
                },
                header: { 'content-type': 'application/x-www-form-urlencoded' },
                method: 'GET',
                dataType: 'json',
                responseType: 'text',
                success: (result) => {
                    console.log(result)
                    that.setData({
                        courselist:result.data.appealList
                    })
                },
                fail: () => { },
                complete: () => { }
              });
         } else {
             
        let teacherid = wx.getStorageSync("userId");
        let that = this
        wx.request({
            url: 'http://localhost:8080/Examination_System_war/wxappeal/wxShowAppeal',
            data: {
                teacherid
            },
            header: { 'content-type': 'application/x-www-form-urlencoded' },
            method: 'GET',
            dataType: 'json',
            responseType: 'text',
            success: (result) => {
                console.log(result)
                that.setData({
                    courselist:result.data.appealList
                })
            },
            fail: () => { },
            complete: () => { }
          });
         }


          
    }
})